import siteMetadata from '@/data/siteMetadata'
import Link from '@/components/Link';
import Logo from '@/data/logo.svg'
import headerNavLinks from '@/data/headerNavLinks';
import SearchButton from '@/components/SearchButton';

export default function Header () {
  return (
    <header className="flex items-center justify-between py-10">
      <div>
        <Link href="/" aria-label={siteMetadata.headerTitle}>
          <div className="flex items-center justify-between">
            <div className="mr-3">
              <Logo />
            </div>
            {typeof siteMetadata.headerTitle === 'string' ? (
              <div className="hidden h-6 text-2xl font-semibold sm:block">
                {siteMetadata.headerTitle}
              </div>
            ) : (
              siteMetadata.headerTitle
            )}
          </div>
        </Link>
      </div>
      <div className="flex items-center space-x-4 leading-5 sm:space-x-6">
        {
          headerNavLinks
            .filter((link) => link.href !== '/' )
            .map((item) => (
              <Link
                key={item.title}
                href={item.href}
                className="hidden font-medium text-gray-900 dark:text-gray-100 sm:block"
              >
                {item.title}
              </Link>
            ))
        }
        <SearchButton />
      </div>
    </header>
  )
}
